package com.yjq.programmer.controller.admin;

import com.yjq.programmer.dto.PageDTO;
import com.yjq.programmer.dto.PosterDTO;
import com.yjq.programmer.dto.ResponseDTO;
import com.yjq.programmer.service.IPosterService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 杨杨吖
 * @QQ 823208782
 * @WX yjqi12345678
 * @create 2022-11-09 9:01
 */
@RestController("AdminPosterController")
@RequestMapping("/admin/poster")
public class PosterController {

    @Resource
    private IPosterService posterService;

    /**
     * 分页获取海报数据
     * @param pageDTO
     * @return
     */
    @PostMapping("/list")
    public ResponseDTO<PageDTO<PosterDTO>> getPosterListByPage(@RequestBody PageDTO<PosterDTO> pageDTO){
        return posterService.getPosterListByPage(pageDTO);
    }

    /**
     * 保存海报数据(添加、修改)
     * @param posterDTO
     * @return
     */
    @PostMapping("/save")
    public ResponseDTO<Boolean> savePoster(@RequestBody PosterDTO posterDTO){
        return posterService.savePoster(posterDTO);
    }

    /**
     * 删除海报数据
     * @param posterDTO
     * @return
     */
    @PostMapping("/remove")
    public ResponseDTO<Boolean> removePoster(@RequestBody PosterDTO posterDTO){
        return posterService.removePoster(posterDTO);
    }
}
